package com.neusoft.neu24.nep.controller;


import com.neusoft.neu24.nep.entity.CommonResult;
import com.neusoft.neu24.nep.entity.Sysnode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/sn")
@RefreshScope
public class SysnodeController {

    @Autowired
    Environment environmentv;

    @RequestMapping("/get/byroleid/{roleid}")
    public CommonResult get(@PathVariable("roleid") Integer roleid) {

        System.out.println(environmentv.getProperty("server.port"));

        List<Sysnode> lsns =new ArrayList<>();
        for (int i = 0; i < roleid ; i++) {
            lsns.add( new Sysnode() );
        }
       return   CommonResult.sucess(lsns);
    }
}

